#--------------------自定义包不能带后缀.py
def print_file_info(file_name):
    f = None#--------------file可能不存在
    try:
        f = open(file_name, "r", encoding="UTF-8")
    except FileExistsError as e:
        print(f"Error:{e}")
    else:
        print(f"内容是：\n{f.read()}")
    finally:
        if f:
            f.close()#--------当file不存在时会导致异常

def append_to_file(file_name, data):
    ff = open(file_name, "a", encoding= "UTF-8")
    ff.write(data)
    ff.close()